﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace TagChimp
{
    /// <summary>
    /// Creates a new EpisodeInfo Instance 
    /// </summary>
    /// <remarks></remarks>
    public class EpisodeInfo
    {
        /// <summary>
        /// Gets or sets the name of the series.
        /// </summary>
        /// <value>The name of the series.</value>
        /// <remarks></remarks>
        public string       SeriesName      { get; set; }
        /// <summary>
        /// Gets or sets the name of the episode.
        /// </summary>
        /// <value>The name of the episode.</value>
        /// <remarks></remarks>
        public string       EpisodeName     { get; set; }
        /// <summary>
        /// Gets or sets the season number.
        /// </summary>
        /// <value>The season number.</value>
        /// <remarks></remarks>
        public int          SeasonNumber    { get; set; }
        /// <summary>
        /// Gets or sets the episode number.
        /// </summary>
        /// <value>The episode number.</value>
        /// <remarks></remarks>
        public int          EpisodeNumber   { get; set; }
        /// <summary>
        /// Gets or sets the type of the media.
        /// </summary>
        /// <value>The type of the media.</value>
        /// <remarks></remarks>
        public string       MediaType       { get; set; }
        /// <summary>
        /// Gets or sets the release date.
        /// </summary>
        /// <value>The release date.</value>
        /// <remarks></remarks>
        public DateTime     ReleaseDate     { get; set; }
        /// <summary>
        /// Gets or sets the genre.
        /// </summary>
        /// <value>The genre.</value>
        /// <remarks></remarks>
        public string       Genre           { get; set; }
        /// <summary>
        /// Gets or sets the rating.
        /// </summary>
        /// <value>The rating.</value>
        /// <remarks></remarks>
        public string       Rating          { get; set; }
        /// <summary>
        /// Gets or sets the directors.
        /// </summary>
        /// <value>The directors.</value>
        /// <remarks></remarks>
        public List<string> Directors       { get; set; }
        /// <summary>
        /// Gets or sets the producers.
        /// </summary>
        /// <value>The producers.</value>
        /// <remarks></remarks>
        public List<string> Producers       { get; set; }
        /// <summary>
        /// Gets or sets the cast.
        /// </summary>
        /// <value>The cast.</value>
        /// <remarks></remarks>
        public List<string> Cast            { get; set; }
        /// <summary>
        /// Gets or sets the episode description.
        /// </summary>
        /// <value>The episode description.</value>
        /// <remarks></remarks>
        public string       Description     { get; set; }
        /// <summary>
        /// Gets or sets the network.
        /// </summary>
        /// <value>The network.</value>
        /// <remarks></remarks>
        public string       Network         { get; set; }
        /// <summary>
        /// Gets or sets the cover art url.
        /// </summary>
        /// <value>The cover art url.</value>
        /// <remarks></remarks>
        public string       CoverArt        { get; set; }


        /// <summary>
        /// Initializes a new instance of the <see cref="EpisodeInfo"/> class.
        /// This Constructor should be used when querying by EpisodeInfo
        /// </summary>
        /// <param name="showname">The showname.</param>
        /// <param name="season">The season.</param>
        /// <param name="episode">The episode.</param>
        /// <remarks></remarks>
        public EpisodeInfo(string showname, int season, int episode):this()
        {
            SeriesName = showname;
            SeasonNumber = season;
            EpisodeNumber = episode;

        }


        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        /// <remarks></remarks>
        public EpisodeInfo()
        {
            SeriesName     = "";
            EpisodeName    = "";
            SeasonNumber   = 0;
            EpisodeNumber  = 0;
            MediaType      = "";
            ReleaseDate    = new DateTime(2011, 01, 01);
            Genre          = "";
            Rating         = "";
            Directors      = new List<string>();
            Producers      = new List<string>();
            Cast           = new List<string>();
            Description    = "";
            Network        = "";
            CoverArt       = "";
        }


        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>A <see cref="System.String"/> that represents this instance.</returns>
        /// <remarks></remarks>
        public override string ToString()
        {
            var type = GetType();
            PropertyInfo[] properties = type.GetProperties();
            var output = new StringBuilder();
            Array.ForEach(properties, property => output.Append(String.Format("{0}: {1} \n", property.Name, property.GetValue(this, null))));

            return output.ToString();
        }


    }





}
